package com.gecba.modular.jpa;

import org.hibernate.MappingException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.IdentityGenerator;

import java.io.Serializable;

/**
 * @author ChenBo
 * @className IdWorkerGenerator
 * @date 2021/7/19 19:13
 */
public class IdWorkerGenerator extends IdentityGenerator {
    @Override
    public Serializable generate(SharedSessionContractImplementor session, Object object) throws MappingException {
        IdWorker idWorker=new IdWorker(0,0);
       Serializable id =  idWorker.nextId();;
        return id;
    }
}
